1. Overview

In this task, I will be working with spatial data regarding the 2008 California DFW oil spill. The analysis will include an interactive tmap of the oil spill sites, and a static choropleth map for which color of each county depends on the count of inland oil spill events.

2. Read in the Spatial Data

ca_oil_spill_sf <- read_sf(here('data/oil_spill/ds394.shp')) %>% 
  clean_names()

ca_counties_sf <- read_sf(here('data/ca_counties/CA_Counties_TIGER2016.shp')) 

ca_subset_sf <- ca_counties_sf %>% 
  clean_names() %>% 
  select(county_name = name, land_area = aland)

3. Create Interactive tmap

ca_oil_spill_sf <-
  st_transform(ca_oil_spill_sf,
               st_crs(ca_subset_sf))

tmap_mode(mode = 'view')

#tm_shape(ca_subset_sf) +
 # tm_fill('county_name', legend.show = FALSE) +
 # tm_shape(ca_subset_sf) +
   tm_shape(ca_subset_sf) +
      tm_borders() + 
     tm_basemap(c(StreetMap = "OpenStreetMap",
             TopoMap =
               "OpenTopoMap")) +
    tm_shape(ca_oil_spill_sf) +
  tm_dots(col = "green3") 

4. Choropleth Map of Oil Spill by County

### Wrangle to find sesbania observations per county

oil_county_sf <- ca_subset_sf %>% 
  st_join(ca_oil_spill_sf)


oil_counts_sf <- oil_county_sf %>% 
  group_by(county_name) %>% 
  summarize(oil_count = sum(!is.na(dfgcontrol)))

# head(oil_counts_sf)

ggplot(data = oil_counts_sf) +
  geom_sf(aes(fill = oil_count),
          color = 'white', size = 0.1) +
  scale_fill_gradientn(colors = c('lightgrey', 'orange', 'red')) +
  theme_minimal() +
  labs(fill = 'Oil Spill Total by County',
       title = "2008 Oil Spill by California County",
       caption = "Figure 1. Oil spill sources by county. 
       The largest concentration of oil spill occured 
       in southwest California. (Lampinen 2008)")

4.01 Data Analysis

From the map created above, we learn that:

  • Most spills were in the southwest region.
  • More spills occured along the coast than the inland region.

5. Data Citation

Lampinen, M. 2008. Department of Fish and Game, Office of Spill Prevention and Response.